{% extends 'base.html.twig' %}

{% block body %}
	<div class="page-content">
        <div class="row">
			<a href="form" class="btn btn-default">
				<i class="icon-pencil align-top bigger-125"></i>
				{{ 'New' | trans }}
			</a>
		</div>
		<br/>
		<div class="row">
			<div class="col-xs-12">
				<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover">
						<thead>
						<tr>
                            {% for label in labels %}
								<th>{{ label|trans }}</th>
                            {% endfor %}
							<th>{{ 'Operation' | trans }}</th>
						</tr>
						</thead>

						<tbody>
                        {% for data in list %}
							<tr>
                                {% for field in fields %}
									<td>
                                        {% if attribute(data, field) is instanceof('DateTime') %}
                                            {{ attribute(data, field) | date }}
                                        {% elseif attribute(data, field) is instanceof('Collection') %}
                                            {{ attribute(data, field) | length }}
                                        {% else %}
                                            {{ attribute(data, field) }}
                                        {% endif %}
									</td>
                                {% endfor %}
								<td>
									<a href="detail/{{ data.id }}">{{ 'Detail' | trans }}</a>
									|
									<a href="form/{{ data.id }}">{{ 'Edit' | trans }}</a>
								</td>
							</tr>
                        {% endfor %}
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
{% endblock %}